Skip to content

refactor: effect/no-unsafe-dictionary-type to zero, at error - #621

Merged
thomasfosterau merged 1 commit into
trunkfrom
lint-no-unsafe-dictionary-type
Nov 12, 2026
Merged

thomasfosterau merged 1 commit into
trunkfrom
lint-no-unsafe-dictionary-type

Conversation

@thomasfosterau

Copy link
Copy Markdown
Owner

Summary

Part of #533.

effect/no-unsafe-dictionary-type goes from 82 sites to 0 and its warn line is removed from vite.config.ts, so the rule runs at error from the preset. I counted on a tree that already had #594, so sites that a local Record binding used to hide are included.

Every site was an open dictionary with an unknown value. Wire shapes (JSON:API meta, attributes, relationships and links) stay open, now spelled R.ReadonlyRecord<string, unknown> from effect/Record instead of a hand-written index signature or the built-in Record. Mutable accumulators are Types.Mutable<R.ReadonlyRecord<string, unknown>>.

Other changes:

  • Filter.FieldTypes changes from an interface to the equivalent type alias.
  • Assemble.ResourceDocument.meta and Client.readTotalCount's source parameter, which had an index signature next to named members, become an intersection with R.ReadonlyRecord<string, unknown>.
  • internal/codecs.ts passes an explicit define<unknown> type argument, because the mutable accumulator is now typed more precisely.
  • The comment above the old rule line in vite.config.ts now covers only the Record interaction with no-known-value-widening.

Lint warning counts, before to after (before measured on trunk with #594 merged in): effect(no-unsafe-dictionary-type) 82 to 0. No other rule has more sites than before. effect/avoid-native-object-helpers is lower on this branch only because #615 landed on trunk in the meantime.

Verification

  • pnpm install --frozen-lockfile: pass
  • vp run build: pass
  • vp check: pass (0 errors, 0 no-unsafe-dictionary-type)
  • vp run check: pass ("every type gate green")
  • vp run -r test:unit: pass (4010, 73, 56 and 50 tests across the four suites)
  • vp run docgen: pass
  • vp run test:coverage, then vp exec fallow audit --base origin/trunk: pass (exit 0; the only finding that got worse is an inherited complexity warning in Endpoint.resource, warn only)

After the final rebase onto trunk (#618) I re-ran only vp run typecheck and the lint count, and both were clean.

Changeset

.changeset/open-dictionary-readonly-record.md, patch. The respelled types are identical, so there is no migration. The FieldTypes interface-to-alias change shows in the emitted declarations.

Notes

  • Filter.FieldTypes is only used as a type-parameter constraint in this repo. A consumer that merges declarations into the interface would be affected, which I judged unlikely.
  • Several of these files use R as a resource type parameter and now also import the R namespace. A type parameter has no namespace meaning, so tsc accepts it. Renaming those parameters to Res is separate work.

Generated by Claude Code

Open dictionaries spell their value as R.ReadonlyRecord<string, unknown>
(effect/Record) instead of index signatures and the built-in Record;
mutable accumulators use Types.Mutable of the same. Filter.FieldTypes
becomes a type alias. The rule's warn line is removed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y5G6PMempKsgjiV1NDcCJY
@changeset-bot

changeset-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8430faf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@thomasfosterau/effect-jsonapi Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants